<?php
namespace DesignPatterns\Creational\Singleton;

final class Singleton {
    private static $instance;

    public static function getInstance(): Singleton { // 懒汉式
        if ( null === static::$instance ) static::$instance = new static();

        return static::$instance;
    }

    private function __construct() {} // 禁止实例化
    private function __clone() {} // 禁止克隆
    private function __wakeup() {} // 禁止反序列化
}
